<?php
include "../../../lib/list.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
<head>
<link rel="stylesheet" href="../../../css/insert.css" type="text/css"></link>
<link rel="stylesheet" href="../../../css/list.css" type="text/css"></link>
<script type="text/javascript" src="../../../js/list.js"></script>
<script type="text/javascript" src="../../../js/calendarDateInput.js"></script>
<script>
function insert_submit(){
		document.insert.action = 'query.php';
		document.insert.target = 'right'; 
		document.insert.method = 'post';
		document.insert.submit();
}
</script>
</head>
<body>
	<div style="width: 1024px; padding: 10px;">
		<div
			style="border-bottom: 1px solid #e8e8e8; text-align: left; font-size: 12px; margin-bottom: 12px; color: #9a9a9a">:::
			마스터 관리&nbsp;⇒&nbsp;구매처 마스터&nbsp;⇒&nbsp;구매처 추가하기</div>

		<form name="insert" method="post" action="query.php">
			<input type="hidden" value="" name="before" /> 
			<input type="hidden" value="insert" name="mode" />
			<div id=register>

			<?php
			$table = "uatp_buyer";
			if($_POST['mode']=='modify'){
				$no = $_POST['chk_no'];
				for($i=0;$i<count($no);$i++){
					$qry  = "select * from $table where no = $no[$i]";
					$list = DBarray($qry);
					?>

				<!--   /////////////////////	  기존 내용 수정하기	 ///////////////////// -->
				<input type="hidden" name="no[]" value="<?=$no[$i]?>"/>
				
				<ul class='line'></ul>
				<ul>
					<li class="lable">구매처 가나</li>
					<li class='value'><input type='text' size='20' name='name[]'
						value='<?=$list['name']?>' readonly onclick="javascript:chk_name('<?=$table?>',this.value);" />
					</li>
					<li class='explain'>:: 특수문자나 중복된 이름은 사용 불가능합니다.</li>
				</ul>
				<ul>
					<li class="lable">구매처 가나</li>
					<li class='value'><input value='<?=$list['name_gana']?>' type='text' size='20' name='name_gana[]'/>
					</li>
				</ul>
				<ul>
					<li class="lable">우편번호</li>
					<li class="value"><input value='<?=$list['post']?>' type="text" size="20" name="post[]" onkeyup="number_check(this)"/>
					</li>
				</ul>
				<ul>
					<li class="lable">도도부현</li>
					<li class="value"><input value='<?=$list['prefecture']?>' type="text" size="20" name="prefecture[]" />
					</li>
				</ul>
				<ul>
					<li class="lable">주소</li>
					<li class="value"><input value='<?=$list['address1']?>' type="text" size="20" name="address1[]" />
					</li>
				</ul>
				<ul>
					<li class="lable">주소2</li>
					<li class="value"><input value='<?=$list['address2']?>' type="text" size="20" name="address2[]" />
					</li>
				</ul>
				<ul>
					<li class="lable">TEL1</li>
					<li class="value"><input value='<?=$list['tel1']?>' type="text" size="20" name="tel1[]" onkeyup="number_check(this)"/>
					</li><li class='explain'>:: 전화번호는 둘중 하나는 입력되어아 합니다.</li>
				</ul>
				<ul>
					<li class="lable">TEL2</li>
					<li class="value"><input value='<?=$list['tel2']?>' type="text" size="20" name="tel2[]" onkeyup="number_check(this)"/>
					</li>
				</ul>
				<ul>
					<li class="lable">FAX1</li>
					<li class="value"><input value='<?=$list['fax1']?>' type="text" size="20" name="fax1[]" onkeyup="number_check(this)"/>
					</li>
				</ul>
				<ul>
					<li class="lable">FAX2</li>
					<li class="value"><input value='<?=$list['fax2']?>' type="text" size="20" name="fax2[]" onkeyup="number_check(this)"/>
					</li>
				</ul>
				<ul>
					<li class="lable">Mail</li>
					<li class="value"><input value='<?=$list['mail']?>' type="text" size="20" name="mail[]" onblur="mail_check(this)"/>
					</li>
				</ul>
				<ul>
					<li class="lable">비고</li>
					<li class="value"><input value='<?=$list['note']?>' type="text" size="20" name="note[]"/>
					</li>
				</ul>
				<!--   /////////////////////	  기존 내용 수정하기	 ///////////////////// -->
			
			<?php
				}
				 }else{
			?>
			
			<!--   /////////////////////  새로운 내용 입력하는 부분    ///////////////////// -->
			<input type="hidden" value="" name="no[]"/>
			<ul class='line'></ul>
				<ul class='line'></ul>

				<ul>
					<li class="lable">구매처 명</li>
					<li class='value'><input type='text' size='20' name='name[]'
						readonly onclick="javascript:chk_name('<?=$table?>',this.value);" />
					</li>
					<li class='explain'>:: 특수문자나 중복된 이름은 사용 불가능합니다.</li>
				</ul>
				<ul>
					<li class="lable">구매처 가나</li>
					<li class='value'><input type='text' size='20' name='name_gana[]'/>
					</li>
				</ul>
				<ul>
					<li class="lable">우편번호</li>
					<li class="value"><input type="text" size="20" name="post[]" onkeyup="number_check(this)"/>
					</li>
				</ul>
				<ul>
					<li class="lable">도도부현</li>
					<li class="value"><input type="text" size="20" name="prefecture[]" />
					</li>
				</ul>
				<ul>
					<li class="lable">주소</li>
					<li class="value"><input type="text" size="20" name="address1[]" />
					</li>
				</ul>
				<ul>
					<li class="lable">주소2</li>
					<li class="value"><input type="text" size="20" name="address2[]" />
					</li>
				</ul>
				<ul>
					<li class="lable">TEL1</li>
					<li class="value"><input type="text" size="20" name="tel1[]" onkeyup="number_check(this)"/>
					</li><li class='explain'>:: 전화번호는 둘중 하나는 입력되어아 합니다.</li>
				</ul>
				<ul>
					<li class="lable">TEL2</li>
					<li class="value"><input type="text" size="20" name="tel2[]" onkeyup="number_check(this)"/>
					</li>
				</ul>
				<ul>
					<li class="lable">FAX1</li>
					<li class="value"><input type="text" size="20" name="fax1[]" onkeyup="number_check(this)"/>
					</li>
				</ul>
				<ul>
					<li class="lable">FAX2</li>
					<li class="value"><input type="text" size="20" name="fax2[]" onkeyup="number_check(this)"/>
					</li>
				</ul>
				<ul>
					<li class="lable">Mail</li>
					<li class="value"><input type="text" size="20" name="mail[]" onblur="mail_check(this)"/>
					</li>
				</ul>
				<ul>
					<li class="lable">비고</li>
					<li class="value"><input type="text" size="20" name="note[]"/>
					</li>
				</ul>
			<!--   /////////////////////  새로운 내용 입력하는 부분    ///////////////////// -->
		<?php }
		?>
		<ul class='line'></ul>
	</div>
			<div style="padding: 5px;">
				<center>
					<input type="button" class="button white small" value="입력하기" onclick="javascript:insert_submit();"/> <input
						type="button" class="button white small" value="취소하기"
						onclick="javacsript:history.go(-1)" />
				</center>
			</div>
		</form>
	</div>
</body>

</html>